package JD;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main1 {

    public static void main(String[] args) throws Exception{
        BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
        String s = buf.readLine();
        String[] ss;
        int n = Integer.parseInt(s);
        int[] x = new int[n];
        int[] y = new int[n];
        for (int i = 0; i < n; i++){
            s = buf.readLine();
            ss = s.split(" ");
            x[i] = Integer.parseInt(ss[0]);
            y[i] = Integer.parseInt(ss[1]);
        }
        Map<Node, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++){
            boolean flag = false;
            for (Node node : map.keySet()) {
                if (Math.abs(x[i] - node.x) == Math.abs(y[i] - node.y)){
                    map.put(node, map.get(node) + 1);
                    flag = true;
                    break;
                }
            }
            if (flag){
                continue;
            }
            Node node = new Node(x[i], y[i]);
            map.put(node, 1);
        }
        int res = 0;
        for (Node node : map.keySet()) {
            int count = map.get(node);
            res += count * (count - 1);
        }
        System.out.println(res);
    }
}
class Node{
    int x;
    int y;
    Node(int x, int y){
        this.x = x;
        this.y = y;
    }
}
